<?php


namespace frontend\controllers\cyf;


use fack\Sms;
use frontend\controllers\common;
use servers\Rest;
use yii\web\Controller;
use yii\web\Request;

class SendsmsController extends Controller
{
    public function actionSendSms(Request $request)
    {
        if(!$request->isPost) return common::fail('10001','null','请求方式不对');
        $phone = $request->post('phone');
        if(empty($phone)) return common::fail('20006','null','手机号不能为空');
        $type = $request->post('type');
        if(empty($type)) return common::fail('20006','null','发送方式不能为空');
        $res  = Sms::sendSms($type,$phone);
        if($res['status'] != 0) return  common::fail('20006','null','发送方式不能为空');
        return  common::fail('0','null','发送成功');

    }
}